<extend name="Layout:default"/>
<block name="title"><title>修改密码——会员中心</title></block>
<block name="style">
<css href="/Public/Assets/Hui/lib/validator/jquery.validator.css"/>
</block>

<block name="main">
<div class="container clearfix">
	<div id="member-container">
		<div><a href="{:U('Member/loginout')}">退出登录</a></div>
		<div class="row">
			<div class="col-3">
				{:W('Category/menu')}
			</div>
			<div class="col-9">
				<div class="panel panel-default">
					<div class="panel-header">修改密码</div>
					<div class="panel-body">
						<form action="{:U('pwd_post')}" method="post" class="form form-horizontal validator_form">
							<div class="row cl mb-20">
						  		<div class="col-2 form-label">原密码:</div>
								<div class="col-5 formControls"><input type="password" class="input-text radius" value="" placeholder="原密码"  name="pwd" data-rule="原密码:required;">
								</div>
						  	</div>
						  	<div class="row cl mb-20">
						  		<div class="col-2 form-label">新密码:</div>
								<div class="col-5 formControls"><input type="password" class="input-text radius" value="" placeholder="新密码"  name="newpwd" data-rule="密码:required;password;">
								</div>
						  	</div>
						  	<div class="row cl mb-20">
						  		<div class="col-2 form-label">确认新密码:</div>
								<div class="col-5 formControls"><input type="password" class="input-text radius" value="" placeholder="再输一次新密码"  name="renewpwd" data-rule="确认密码:required;match(newpwd);">
								</div>
						  	</div>
						  	<div class="row cl mb-20">
								<div class="col-md-offset-2 ">
									<input class="btn btn-primary btn-block radius size-M" type="submit" value="修改密码">
								</div>
						  	</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</block>

<block name="script">
<js href="/Public/Assets/Hui/lib/validator/jquery.validator.js"/>
<js href="/Public/Assets/Hui/lib/validator/local/zh_CN.js"/>
<js href="/Public/Sea/modules/layer/2.1/layer/layer.js"/>
<script>
$('.validator_form').validator({
	//msgClass: "n-bottom", 
	//msgIcon:"",
	    valid: function(form){
	    	var me = this;
	    	//防止重复提交表单
	        me.holdSubmit();
	        var ii = layer.msg('数据处理中...', {icon: 16,time: 10000}, function(){
    	    layer.alert('服务器响应超时', {icon: 7});
    	});
	     	$.ajax({
            url:  $(form).attr('action'),
            data: $(form).serialize(),
            type: "POST",
            dataType:"json",
            success: function(data){
            	layer.close(ii);
            	//data = JSON.parse(data);  //str 转 json
            	if (data.status==1) {
            		layer.msg(data.info, {icon: 1,time:1000});
                }else{
                	layer.msg(data.info, {icon: 2,time:1000});
                }
            	//需要跳转的话
            	if(data.url){
                   	setTimeout(function(){
                   		location.href= data.url;
                   	},1000);
                   }
            	
            	//信息提示框结束之后，表单可提交
            	setTimeout(function(){
            		me.holdSubmit(false);
                 },1000);
            	
            }
    	});
	   	}
});
</script>
</block>